package com.ysz.component.page;

import java.util.List;

/**
 * @ClassName PageView
 * @Description 分页pojo类
 * @Data 11:03
 * @Version 1.0
 * @Author ysz
 */
public class PageView<T> {

    private static final Long DEFAULT_PAGE = 1L;
    private static final Integer DEFAULT_LIMIT = 10;

    /**
     * 总记录数
     */
    private Long total;

    /**
     * 总页数
     */
    private Long totalPage;

    /**
     * 当前页
     */
    private Long page;

    /**
     * 每页多少
     */
    private Integer limit;

    /**
     * 查询出的数据
     */
    private List<T> data;

    /**
     * 是否查询总数
     */
    private Boolean doCount;

    public PageView(Long page, Integer limit, Boolean doCount) {
        this.page = page;
        this.limit = limit;
        this.doCount = doCount;
    }

    public PageView(Long page, Integer limit) {
        this(page, limit, true);
    }

    public PageView() {
        this(DEFAULT_PAGE, DEFAULT_LIMIT, true);
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Long getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Long totalPage) {
        this.totalPage = totalPage;
    }

    public Long getPage() {
        return page;
    }

    public void setPage(Long page) {
        this.page = page;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public Boolean getDoCount() {
        return doCount;
    }

    public void setDoCount(Boolean doCount) {
        this.doCount = doCount;
    }
}
